


#ifndef _FAULT_ANALYSE_H_
#define _FAULT_ANALYSE_H_


#include "stdint.h"

#define COMM_OVERTIME_MAX  20000



typedef enum
{
	ENUM_NAV = 0,
	ENUM_BAT = 1,
	ENUM_CLEAN = 2,
	
	ENUM_COMM_ALL

}ENUM_COMM_LOSS;




typedef union
{
	
	struct
	{
		uint16_t nav_comm_ot :1;
		uint16_t bat_comm_ot :1;
		uint16_t clean_comm_ot :1;
		
		uint16_t reserve : 5;
		
	
	}bit;

	uint16_t data[2];
	uint32_t all;

}STR_FAULT_CODE;



extern STR_FAULT_CODE faultCode;


extern void fault_param_init(void);

extern void set_comm_loss_time(ENUM_COMM_LOSS type, uint16_t loss_ms);
extern void reset_comm_loss_time(ENUM_COMM_LOSS type);


extern void comm_overtime_detect(uint16_t runtime_ms);

extern void fault_code_update(void);
extern void fault_code_clear(void);




#endif


